﻿/// <reference name="MicrosoftAjax.js"/>

Type.registerNamespace("ContactData.UI");
ContactData.UI.LinkButton = function (element) {
    ContactData.UI.LinkButton.initializeBase(this, [element]);
    this._hiddenElementID = null;
    this._lookupName = null;
}

ContactData.UI.LinkButton.prototype = {
    initialize: function () {
        ContactData.UI.LinkButton.callBaseMethod(this, 'initialize');
        this._onClickHandler = Function.createDelegate(this, this._onClick);
        $addHandlers(this.get_element(), { 'click': this._onClick }, this);
    },

    dispose: function () {
        $clearHandlers(this.get_element());
        ContactData.UI.LinkButton.callBaseMethod(this, 'dispose');
    },

    _onClick: function (e) {
        $get(this._hiddenElementID).value = this._lookupName;
    },

    _hiddenElementID: String,
    _lookupName: String,

    get_hiddenElementID: function () { return this._hiddenElementID; },
    set_hiddenElementID: function (value) { this._hiddenElementID = value; },
    get_lookupName: function () { return this._lookupName; },
    set_lookupName: function (value) { this._lookupName = value; }
}

ContactData.UI.LinkButton.registerClass('ContactData.UI.LinkButton', Sys.UI.Control);

if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();